import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class DraggableScrollableSheetPage extends StatelessWidget {

BuildContext tmpContext;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('DraggableScrollableSheet'),
        actions: <Widget>[
          RaisedButton(child: Text('复位'), onPressed: () {
            DraggableScrollableActuator.reset(tmpContext);
          },),
        ],
      ),
      body: SizedBox.expand(
        child: DraggableScrollableActuator(
          child: DraggableScrollableSheet(
            initialChildSize: 0.6,
            maxChildSize: 0.9,
            minChildSize: 0.6,
            builder: (BuildContext context, ScrollController scrollController) {
              tmpContext = context;
              return Container(
                color: Colors.blue[100],
                child: ListView.builder(
                  controller: scrollController,
                  itemCount: 25,
                  itemBuilder: (BuildContext context, int index) {
                    return ListTile(title: Text('Item $index'));
                  },
                ),
              );
            },
          ),
        ),
      ),
    );
  }
}